import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 *	@class memberInfo
 *  @description Variable (struct) class for storing member's information 
 *  @author CLLM
 *  @version 1.0
 */
public class StructMemberInfo {
	
	public int idNo; // primary key
	private String firstName; // First Name
	private String middleName; // Middle Name
	private String lastName; // Last Name
	private String emailAdd; // Email Address
	private String contactNo; // Contact Number
	private String course;	//Course
	private Calendar Birthday;	// Birthday
	private int	memberType; // Member Type (0 - Member Old, 1 - Member New, 2 - Member Honorary, 3- Neophyte, 4- Officer, 5- President)
	private String description; // description
	
	public StructMemberInfo(){
	}
	
	/**
	 * @name memberInfo() (CONSTRUCTOR)
	 * @description	constructor method for the memberInfo (v1 where attribute of birthday is separated as month, day and year)
	 * 
	 * @param idNo			ID No
	 * @param firstName		First Name
	 * @param middleName	Middle Name
	 * @param lastName		Last Name
	 * @param emailAdd		Email Address
	 * @param contactNo		Contact No
	 * @param course		Course
	 * @param monthBday		Birthday - Month 
	 * @param dayBday		Birthday - Day
	 * @param yearBday		Birthday - Year
	 * @param memberType	Member Type (0 - Member Old, 1 - Member New, 2 - Member Honorary, 3- Neophyte, 4- Officer, 5- President)
	 * @param description	notes
	 */
	public StructMemberInfo(int idNo, String firstName, String middleName, String lastName,
			String emailAdd, String contactNo, String course, int monthBday, int dayBday, int yearBday, int memberType,
			String description) {
		super();
		this.idNo = idNo;
		this.firstName = firstName;
		this.middleName = middleName;
		this.lastName = lastName;
		this.emailAdd = emailAdd;
		this.contactNo = contactNo;
		this.course = course;
		this.memberType = memberType;
		this.description = description;
		Birthday.set(yearBday, monthBday, dayBday);
	}
	
	
	/**
	 * @name memberInfo() (CONSTRUCTOR)
	 * @description	constructor method for the memberInfo (v2 where birthday is read as String YYYYMMDD)
	 * 
	 * @param idNo			ID No
	 * @param firstName		First Name
	 * @param middleName	Middle Name
	 * @param lastName		Last Name
	 * @param emailAdd		Email Address
	 * @param contactNo		Contact No
	 * @param course		Course
	 * @param birthday		Birthday (String Input YYYYMMDD)
	 * @param memberType	Member Type (0 - Member Old, 1 - Member New, 2 - Member Honorary, 3- Neophyte, 4- Officer, 5- President)
	 * @param description	notes
	 */
	public StructMemberInfo(int idNo, String firstName, String middleName,
			String lastName, String emailAdd, String contactNo, String course,
			String birthday, int memberType, String description) {
		super();
		this.idNo = idNo;
		this.firstName = firstName;
		this.middleName = middleName;
		this.lastName = lastName;
		this.emailAdd = emailAdd;
		this.contactNo = contactNo;
		this.course = course;
		this.Birthday.set(Integer.parseInt(birthday.substring(0, 4)), Integer.parseInt(birthday.substring(4, 6)), Integer.parseInt(birthday.substring(6, 8)));
		this.memberType = memberType;
		this.description = description;
	}

	/**
	 * @name getFirstName()  
	 * @description Getter method for variable firstName
	 * @return (String) value of firstName
	 */
	public String getFirstName() {
		return firstName;
	}
	
	/**
	 * @name setFirstName(String firstName)
	 * @description Setter method for variable firstName
	 * @param firstName set the Value of firstName
	 */
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	
	/**
	 * @name getLastName()  
	 * @description Getter method for variable lastName
	 * @return (String) value of lastName
	 */
	public String getLastName() {
		return lastName;
	}
	
	/**
	 * @name setLastName(String lastName)
	 * @description Setter method for variable lastName
	 * @param lastName set the Value of lastName
	 */
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	
	/**
	 * @name getMiddleName()  
	 * @description Getter method for variable middleName
	 * @return (String) value of middleName
	 */
	public String getMiddleName() {
		return middleName;
	}

	/**
	 * @name setMiddleName(String middleName) 
	 * @description Setter method for variable middleName
	 * @param middleName set the Value of middleName
	 */
	public void setMiddleName(String middleName) {
		this.middleName = middleName;
	}
	
	/**
	 * @name getEmailAdd()  
	 * @description Getter method for variable emailAdd
	 * @return (String) value of emailAdd
	 */
	public String getEmailAdd() {
		return emailAdd;
	}
	
	/**
	 * @name setEmailAdd(String emailAdd)
	 * @description Setter method for variable emailAdd
	 * @param emailAdd set the Value of emailAdd
	 */
	public void setEmailAdd(String emailAdd) {
		this.emailAdd = emailAdd;
	}
	
	/**
	 * @name getContactNo()
	 * @description Getter method for variable contactNo
	 * @return (String) value of contactNo
	 */
	public String getContactNo() {
		return contactNo;
	}
	
	/**
	 * @name setContactNo(String contactNo)
	 * @description Setter method for variable contactNo
	 * @param contactNo set the Value of contactNo
	 */
	public void setContactNo(String contactNo) {
		this.contactNo = contactNo;
	}
	
	public int getMemberTypeNo() {
		return memberType;
	}
	public String getMemberType() {
		switch(memberType){
			case 0: return "Member"; 
			case 1: return "Officer"; 
			case 2: return "President"; 
			default: return "Unknown"; 
		}
	}
	
	
	public void setMemberType(String memberTypeName) {
		if(memberTypeName.equals("Member"))
			memberType = 0;
		else if(memberTypeName.equals("Officer"))
			memberType = 1;
		else if(memberTypeName.equals("President"))
			memberType = 2;
		else
			memberType = 9;
	}
	
	public void setMemberTypeNo(int memberType) {
		this.memberType = memberType;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}




	public void setMemberType(int memberType) {
		this.memberType = memberType;
	}
	
	
	public String getCourse() {
		return course;
	}

	public void setCourse(String course) {
		this.course = course;
	}

	public void setBirthday(int year, int month, int day){
		Birthday.set(year, month, day);
	}
	
	public String getBirthdayYYYYMMDD(){
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyymmdd");
		return dateFormat.toString();
	}
	
	public int getDayBirthday(){
		SimpleDateFormat dateFormat = new SimpleDateFormat("dd");
		return Integer.parseInt(dateFormat.toString());
	}
	
	public int getMonthBirthday(){
		SimpleDateFormat dateFormat = new SimpleDateFormat("mm");
		return Integer.parseInt(dateFormat.toString());
	}
	
	public int getYearBirthday(){
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy");
		return Integer.parseInt(dateFormat.toString());
	}
}
